<template>
  <div>
    <el-card class="box-card">
      <div
        class="title"
        style="color: #333333; font-size: 20px; font-weight: bold"
      >
        条件筛选
      </div>

      <el-form
        label-position="right"
        label-width="100px"
        size="mini"
        :inline="true"
        :model="ss"
        ref="refform"
        class="demo-form-inline wrap_inline"
        style="background: #fff"
      >
        <el-table-column
          show-overflow-tooltip
          label="日期"
          prop="name"
          width="120"
        ></el-table-column>
        <el-form-item label="台区名称:">
          <el-input
            v-model="ss.name"
            clearable
            placeholder="请输入台区名称"
            class="input_inner_header"
          ></el-input>
        </el-form-item>
        <el-form-item label="台区编码:">
          <el-input
            v-model="ss.name"
            placeholder="请输入台区编码"
            clearable
            class="input_inner_header"
          ></el-input>
        </el-form-item>
        <el-form-item label="所属区域:">
          <el-select
            v-model="ss.serviceType"
            placeholder="请选择"
            clearable
            class="input_inner_header"
          >
            <el-option
              v-for="item in serviceTypes"
              :key="item.value"
              :label="item.name"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button
            style="margin-left: 299px; border-radius: 4px 4px 4px 4px"
            type="primary"
            @click="cx"
            >导出历史负荷</el-button
          >
          <el-button
            style="margin-left: 13px; border-radius: 4px 4px 4px 4px"
            type="primary"
            @click="cx"
            >查询</el-button
          >
          <el-button
            @click="reset"
            type="primary"
            style="margin-left: 13px; border-radius: 4px 4px 4px 4px"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>
<style lang="scss" scoped>
.el-button--primary {
  background: #009999 !important;
  border-color: #009999 !important;
}
.el-form-item__label {
  width: 70px !important;
}

.box-card {
  height: 131px;
  width: 1580px;
  position: relative;
  margin: 20px;
}

.wrap_inline .input_inner {
  width: 180px;
}
.wrap_inline {
  background: #fff;
  padding: 14px 0px;
  .el-form-item {
    margin-bottom: 12px;
  }
}
</style>
<script>
import { mapState, mapMutations } from "vuex";
export default {
  data() {
    return {
      serviceTypes: [],
      orgTypes: [],
      regionId: [],
      ss: {
        name: null,
        type: null,
        serviceType: null,
        regionId: null,
        linkName: null,
        linkPhone: null,
      },
      defaultProps: {
        checkStrictly: true,
        children: "children",
        value: "id",
        label: "name",
      },
    };
  },
  created() {},
  computed: {
    ...mapState(["regTree"]),
  },
  methods: {
    setData() {
      this.serviceTypes = this.$parent.$parent.$parent.serviceTypes;
      this.orgTypes = this.$parent.$parent.$parent.orgTypes;
    },
    //省市区三联框点击后触发
    handleChange(value) {
      this.ss.regionId = value[value.length - 1]; //取地区里最后一个值发给后端
    },
    cx() {
      this.$parent.$parent.$parent.$refs.biaoge.cx(this.ss);
      this.$parent.$parent.$parent.$refs.biaoge.ids = null;
      this.$parent.$parent.$parent.$refs.tree.selOrg = null;
    },
    reset() {
      this.ss = {};
      this.regionId = [];
      this.$parent.$parent.$parent.$refs.biaoge.ids = null;
      this.$parent.$parent.$parent.$refs.tree.selOrg = null;
    },
    getTreeData(data) {
      for (var i = 0; i < data.length; i++) {
        if (data[i].children.length < 1) {
          data[i].children = undefined;
        } else {
          this.getTreeData(data[i].children);
        }
      }
      return data;
    },
  },
};
</script>
